package com.bailian.spring.ioc.prototype_lifecycle;

import com.bailian.spring.ioc.prototype_lifecycle.bean.Pen;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author gaoxu
 * date: Created on 2021/11/1 下午4:18
 */
public class PrototypeLifecycleApplication {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(PrototypeLifecycleConfiguration.class);
        System.out.println("IOC容器初始化完成....");

        System.out.println("准备获取一个Pen。。。");
        Pen pen = ctx.getBean(Pen.class);
        System.out.println("已经取到了Pen。。。");

        System.out.println("准备销毁IOC容器....");
        ctx.close();
        System.out.println("准备销毁IOC容器完成...");
    }
}
